how to apply the chain rule of differentiation